package com.mall.business.service;

import java.util.List;
import com.mall.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mall.business.mapper.BusOrderMapper;
import com.mall.business.domain.entity.BusOrder;
import com.mall.common.core.text.Convert;

/**
 * 订单Service业务层处理
 *
 * @author zhonglin
 * @date 2020-05-24
 */
@Service
public class BusOrderService {

  @Autowired
  private BusOrderMapper busOrderMapper;

  /**
   * 查询订单
   *
   * @param orderId 订单ID
   *
   * @return 订单
   */
  public BusOrder selectBusOrderById(Long orderId) {

    return busOrderMapper.selectBusOrderById(orderId);
  }

  /**
   * 查询订单列表
   *
   * @param busOrder 订单
   *
   * @return 订单
   */
  public List<BusOrder> selectBusOrderList(BusOrder busOrder) {

    return busOrderMapper.selectBusOrderList(busOrder);
  }

  /**
   * 新增订单
   *
   * @param busOrder 订单
   *
   * @return 结果
   */
  public int insertBusOrder(BusOrder busOrder) {

    busOrder.setCreateTime(DateUtils.getNowDate());
    return busOrderMapper.insertBusOrder(busOrder);
  }

  /**
   * 修改订单
   *
   * @param busOrder 订单
   *
   * @return 结果
   */
  public int updateBusOrder(BusOrder busOrder) {

    busOrder.setUpdateTime(DateUtils.getNowDate());
    return busOrderMapper.updateBusOrder(busOrder);
  }

  /**
   * 删除订单对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteBusOrderByIds(String ids) {

    return busOrderMapper.deleteBusOrderByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除订单信息
   *
   * @param orderId 订单ID
   *
   * @return 结果
   */
  public int deleteBusOrderById(Long orderId) {

    return busOrderMapper.deleteBusOrderById(orderId);
  }

}
